package finbudget.client.lists;

import java.util.HashMap;

import finbudget.client.lists.GetListOfItems.BudgetListItem;

public class BudgetListItemWithProperties extends BudgetListItem {

	private HashMap<String, String> properties;

	/** Serialization requirements */
	public BudgetListItemWithProperties() {
		super();
	}

	public BudgetListItemWithProperties(String name, String key) {
		this.name = name;
		this.key = key;
	}

	public void addProperty(String property, String value) {
		if (property != null) {
			if (properties == null) {
				properties = new HashMap<String, String>();
			}
			if (value == null) {
				properties.remove(property);
			} else {
				properties.put(property, value);
			}
		}
	}

	public String getValue(String key) {
		if (properties != null) {
			return properties.get(key);
		} else {
			return null;
		}
	}

}
